//    Copyright (C) Kherty.  All rights reserved.
using System.Collections.Generic;
using OpenLS.Core.Serialization;

namespace OpenLS.Vml
{
    public class Formulas: ShapeElement
    {
        internal const string xmlName = "formulas";
        internal override void ReadXmlCore(ReadContext context)
        {
            using (var c = context.Read(xmlName))
            {
                while (c.ReaderLocalName == "f")
                {
                    using (ReadContext c2 = context.Read("f"))
                    {
                        Equations.Add(c2.GetString("eqn"));
                    }
                }
            }
        }

        internal override void WriteXmlCore(WriteContext context)
        {
            using (WriteContext c = context.Write(xmlName))
            {
                foreach (string s in Equations)
                {
                    using (WriteContext c2 = c.Write("f"))
                    {
                        c2.SetString("eqn", s);
                    }
                }
            }
        }
        private readonly List<string> _equations = new List<string>();

        public List<string> Equations
        {
            get { return _equations; }
        }
	
    }
}
